<jsp:include page="header.jsp">
			<jsp:param value="null" name="item"/>
</jsp:include>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<section class="content">
	<section class="widget"  id="department" >
		<header>
			<span class="icon">&#128196;</span>
			<hgroup>
				<h1>个人中心</h1>
				<h2>个人信息详情</h2>
			</hgroup>
		</header>
		<div class="content">
		    <s:form action="updateUserInfo" method="post">
		    	<div id="personAvatar">
		    		<img src="images/admin.jpg" alt="" height="100" width="100" />
		    	</div>
		    	<div id="personalMsg">
		    		<ul>
			    		<li><label>员工号：</label><span><s:property value='userInfo.userid' /></span></li>
			    		<li><label>姓名：</label><input type="text"  name="userInfo.userName" value="<s:property value='userInfo.userName' />"></li>
			    		<li><label>性别：</label><span><s:if test='userInfo.gender == "女"'>
													<s:select name="userInfo.gender" list="{'男'}" headerKey="%{userInfo.gender}" headerValue="%{userInfo.gender}"/>
					    							</s:if>
					    							<s:else>
					    							<s:select name="userInfo.gender" list="{'女'}" 
					    							headerKey="%{userInfo.gender}" headerValue="%{userInfo.gender}"/>
					    							</s:else>
					    					</span></li>
					    <li><label>部门：</label><span><s:property value='userInfo.department.departmentName' /></span></li>
					    <li><label>职位：</label><span><s:property value='userInfo.position' /></span></li>
					    <li><label>邮箱：</label>
						    <s:if test='userInfo.emailValidated != "是"'>
						    	<input type="text" name="userInfo.email" value="<s:property value='userInfo.email' />">
						    	<input type="submit" formaction="sendEmail" class="button white" value="验证邮箱"/></li>
					    	</s:if>
					    	<s:else>
					    		<input type="text" readOnly="true" name="userInfo.email" value="<s:property value='userInfo.email' />">
					    	</s:else>
					    <li><label>我的点数：</label><span><s:property value='userInfo.count' /></span>&nbsp;&nbsp;<a href="getExchangePage">兑换</a></li>
					    <input type="hidden" id="pwd" value="<s:property value='userInfo.Pwd' />"/>
				    </ul>
				    <input type="submit" class="button white" value="修改">
				    <input type="button" class="button white"  id="updatePwd" value="更改密码">
		    	</div>
		    </s:form>
		    <div id="popup" class="hide">		
					<s:form action="updatePassword" method="post">
					
						<table id="myTable">
							<tr>
								<td>员工号</td>
								<td><input type="text" name="userInfo.userid" readonly="readonly" value="<s:property value='userInfo.userid' />" /></td>
							</tr>
							<tr>
								<td>密码</td>
								<td><input type="password" name="userInfo.pwd" id="oldPwd" value="" minlength="6" maxlength="15"/></td>
							</tr>
							<tr>
								<td>新密码</td>
								<td><input type="password" name="newPassword" value="" minlength="6" maxlength="15" required/></td>
							</tr>
							<tr>
								<td>确认密码</td>
								<td><input type="password" name="confirmedPassword" value="" minlength="6" maxlength="15" required/></td>
							</tr>
						</table>
						<div>
							<!-- <input type="submit" onclick="return check();" class="white" value="提交"> -->
							<input type="submit" onclick="return check();" class="white" value="提交">
				    		<input type="reset"   class="white" value="重置"/>
						</div>
					</s:form>
		    </div>
		</div>
		</section>
		<script>
		//添加信息
		var updatePwd =document.getElementById("updatePwd");
		updatePwd.onclick=function(){
	    	layer.open({
			        type: 1,
			        skin:'layui-layer-lan',
			        area: ['360px', '450px'],
			        shadeClose: true, //点击遮罩关闭
			        content:$('#popup')
			    });
		}
			    /* function check(){
			    	var pwdVal=document.getElementById("pwd").value;
			    	var oldVal=document.getElementById("oldPwd").value;
					alert(pwdVal+"::"+oldVal);
			    	if(pwdVal!=oldVal){
			    		alert("输入的原密码不正确！");
			    		return false;
			    	}
			    } */
			    
		var message="<%=request.getAttribute("message")%>";
		if(message!="null"){
			alert(message);
		}
		</script>
<%@ include file="footer.jsp" %>    

